#ifndef FLOWPLOT_H
#define FLOWPLOT_H

#include <qwt/qwt_plot.h>
#include <qwt/qwt_plot_curve.h>

#define HISTORY 60 // seconds

class FlowCurve: public QwtPlotCurve
{
public:
    FlowCurve( const QString &title ):
        QwtPlotCurve( title )
    {
        setRenderHint( QwtPlotItem::RenderAntialiased );
    }

    void setColor( const QColor &color )
    {
        QColor c = color;
        c.setAlpha( 150 );

        setPen( c );
        setBrush( c );
    }
};

class FlowPlot : public QwtPlot
{
    Q_OBJECT

public:

    FlowPlot( QWidget * = 0 );

    void setData(double value){
        data[0] = value;
    }

    void setTitle(const QString &);

protected:
    void timerEvent( QTimerEvent *e );

private:
    FlowCurve *curve;

    double data[HISTORY];
    double timeData[HISTORY];

    int dataCount;
};


#endif // FLOWPLOT_H
